<?php

class TemplateCommon1ContentDao{

	public function getTemplateCommon1Content($pageId){
		$sql = "select * from template_common1_content where pageId=".$pageId;
		
		$con = mysql_connect(DB_HOST, DB_USER, DB_PWD);
		if (!$con){
			die('Could not connect: ' . mysql_error());
		}
		
		mysql_select_db(DB_NAME, $con);
		$result = mysql_query($sql);
		
		$templateCommon1Content = null;
		while($row = mysql_fetch_array($result)){
			$templateCommon1Content = new TemplateCommon1Content($row);
		}
		
		mysql_close($con);
		
		return $templateCommon1Content;
	}

}


class TemplateCommon1Content{
	public $id;
	public $content;
	public $pageId;
	
	public function __construct($row){
		$this->id = $row["id"];
		$this->content = $row["content"];
		$this->pageId =  $row["pageId"];
	}
}

?>